package kortsoft.culcon.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import kortsoft.culcon.manager.GameManager;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class GameListController implements Controller {
	
	public static final String ATTRIBUTE_GAMES = "games";	
	private String successView;
	private GameManager gameManager;

	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws Exception {		
		return new ModelAndView(getSuccessView(),ATTRIBUTE_GAMES,getGameManager().listGames());
	}

	public GameManager getGameManager() {
		return gameManager;
	}

	public void setGameManager(GameManager gameManager) {
		this.gameManager = gameManager;
	}

	public String getSuccessView() {
		return successView;
	}

	public void setSuccessView(String successView) {
		this.successView = successView;
	}

}
